package com.itheima.reggie.common.util;

import com.itheima.reggie.common.UserIdThreadLocal;
import com.itheima.reggie.entity.CommonColumn;


import java.time.LocalDateTime;

//自动注入公共属性的工具类,mybatis用
public class modifyColumnUtil {

    public static void saveModify(CommonColumn column){
        Long userId = UserIdThreadLocal.getId();
        column.setCreateUser(userId);
        column.setCreateTime(LocalDateTime.now());
        column.setUpdateUser(userId);
        column.setUpdateTime(LocalDateTime.now());
    }
    public static void updateModify(CommonColumn column){
        Long userId = UserIdThreadLocal.getId();
        column.setUpdateTime(LocalDateTime.now());
        column.setUpdateUser(userId);
    }
}
